Socket
Socket
Sign inDemoInstall

lodash.mergewith

Package Overview
Dependencies
Maintainers
2
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lodash.mergewith

The Lodash method `_.mergeWith` exported as a module.


Version published
Weekly downloads
5.7M
increased by5.06%
Maintainers
2
Weekly downloads
 
Created

What is lodash.mergewith?

The lodash.mergewith package is a utility library that provides a method for deep merging objects. It allows for custom merge functions to be specified, enabling more complex merging strategies than the default deep merge.

What are lodash.mergewith's main functionalities?

Deep Merging Objects

This feature allows for deep merging of objects with a custom merge function. In this example, arrays are concatenated instead of being replaced.

const _ = require('lodash.mergewith');

const object = { 'a': [{ 'b': 2 }, { 'd': 4 }] };
const other = { 'a': [{ 'c': 3 }, { 'e': 5 }] };

function customizer(objValue, srcValue) {
  if (Array.isArray(objValue)) {
    return objValue.concat(srcValue);
  }
}

const result = _.mergeWith(object, other, customizer);
console.log(result); // { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }

Other packages similar to lodash.mergewith

Keywords

FAQs

Package last updated on 10 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc